package com.wakala.employment.http.bean;


import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class SystemCityTreeVo implements Serializable , Parcelable {

    private static final long serialVersionUID=1L;


    private Integer id;

    /**
     * 城市id
     */
    private Integer cityId;

    /**
     * 省市级别
     */
    private Integer level;

    /**
     * 父级id
     */
    private Integer parentId;

    /**
     * 区号
     */
    private String areaCode;

    /**
     * 名称
     */
    private String name;

    /**
     * 名称
     */
    private String mergerName;

    /**
     * 经度
     */
    private String lng;

    /**
     * 纬度
     */
    private String lat;

    /**
     * 是否展示
     */
    private Boolean isShow;

    /**
     * 下级列表
     */
    private List<SystemCityTreeVo> child = new ArrayList<>();

    protected SystemCityTreeVo(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readInt();
        }
        if (in.readByte() == 0) {
            cityId = null;
        } else {
            cityId = in.readInt();
        }
        if (in.readByte() == 0) {
            level = null;
        } else {
            level = in.readInt();
        }
        if (in.readByte() == 0) {
            parentId = null;
        } else {
            parentId = in.readInt();
        }
        areaCode = in.readString();
        name = in.readString();
        mergerName = in.readString();
        lng = in.readString();
        lat = in.readString();
        byte tmpIsShow = in.readByte();
        isShow = tmpIsShow == 0 ? null : tmpIsShow == 1;
        child = in.createTypedArrayList(SystemCityTreeVo.CREATOR);
    }

    public static final Creator<SystemCityTreeVo> CREATOR = new Creator<SystemCityTreeVo>() {
        @Override
        public SystemCityTreeVo createFromParcel(Parcel in) {
            return new SystemCityTreeVo(in);
        }

        @Override
        public SystemCityTreeVo[] newArray(int size) {
            return new SystemCityTreeVo[size];
        }
    };

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getCityId() {
        return cityId;
    }

    public void setCityId(Integer cityId) {
        this.cityId = cityId;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMergerName() {
        return mergerName;
    }

    public void setMergerName(String mergerName) {
        this.mergerName = mergerName;
    }

    public String getLng() {
        return lng;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public Boolean getShow() {
        return isShow;
    }

    public void setShow(Boolean show) {
        isShow = show;
    }

    public List<SystemCityTreeVo> getChild() {
        return child;
    }

    public void setChild(List<SystemCityTreeVo> child) {
        this.child = child;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        if (id == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeInt(id);
        }
        if (cityId == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeInt(cityId);
        }
        if (level == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeInt(level);
        }
        if (parentId == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeInt(parentId);
        }
        parcel.writeString(areaCode);
        parcel.writeString(name);
        parcel.writeString(mergerName);
        parcel.writeString(lng);
        parcel.writeString(lat);
        parcel.writeByte((byte) (isShow == null ? 0 : isShow ? 1 : 2));
        parcel.writeTypedList(child);
    }
}
